package org.dbstar.scheduler.job.cmd;

import org.dbstar.scheduler.beans.CmdJobConf;
import org.dbstar.scheduler.beans.Job;
import org.dbstar.scheduler.control.JobController;
import org.dbstar.scheduler.job.IllegalFactoryException;
import org.dbstar.scheduler.job.JobRunner;
import org.dbstar.scheduler.job.JobRunnerFactory;


/**
 * 创建命令行Job执行器的工厂类
 * 
 * @author 代波
 * @since 1.0.0
 * @version 1.0.0
 * @date 2012-3-26
 */
public final class CmdRunnerFactory implements JobRunnerFactory {
	@Override
	public JobRunner createJobRunner(JobController jobController, Job job) throws IllegalFactoryException {
		if (CmdJobConf.JOB_TYPE.equals(job.getType())) {
			return new CmdJobRunner(jobController, job);
		} else {
			throw new IllegalFactoryException("Not a CmdJob: " + job.getType());
		}
	}
}
